﻿using System.Security.Claims;

namespace Zhp.Common.WebApp
{
    public interface ICurrentUser
    {
        string CacheId { get; }
        long OnlineId { get; }
        /// <summary>
        /// 远程请求IP
        /// </summary>
        string RemoteIpAddress { get; }

        /// <summary>
        /// jwt编号
        /// </summary>
        long RefreshTokenId { get; }
        long AccessTokenId { get; }

        string TokenType { get; }

        /// <summary>
        /// 语言编码
        /// </summary>
        public int CompanyCode { get; set; }

        /// <summary>
        /// 当前登录用户UserID
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// 当前登录账号
        /// </summary>
        public string WorkDayId { get; set; }

        /// <summary>
        /// 当前登录账号
        /// </summary>
        public string UserCode { get; set; }

        /// <summary>
        /// 当前登录用户名称
        /// </summary>
        string UserName { get; }

        /// <summary>
        /// 当前登录用户角色ID
        /// </summary>
        List<long> RoleIds { get; }

        /// <summary>
        /// 请求携带的Token
        /// </summary>
        /// <returns></returns>
        string GetToken();

        /// <summary>
        /// 是否已认证
        /// </summary>
        /// <returns></returns>
        bool IsAuthenticated();

        /// <summary>
        /// 获取用户身份权限
        /// </summary>
        /// <returns></returns>
        IEnumerable<Claim> GetClaimsIdentity();

        /// <summary>
        /// 根据权限类型获取详细权限
        /// </summary>
        /// <param name="claimType"></param>
        /// <returns></returns>
        List<string> GetClaimValueByType(string claimType);

        List<string> GetUserInfoFromToken(string claimType);
    }
}
